<?php 

/**
 * 类型属性控制器
 * @author 董满 <970473068@qq.com>
 */
class TypeattrController extends Controller{
	private $model;
	public function __init(){
		parent::__init();
		$this->model=K('Typeattr');
	}
    /**
     * 属性列表
     */
    public function index(){
    	//获取tid
    	$type_tid=Q('get.tid',0,'intval');
		$data = $this->model->where("type_tid={$type_tid}")->all();
		$this->assign('data',$data);
		$this->display(); 
    }
	/**
	 * 删除
	 */
	 public function del(){
	 	//获得taid
	 	$taid=Q('get.taid',0,'intval');
		$this->model->where("taid={$taid}")->delete();
		$this->success('删除成功');
	 }
	 /**
	  * 编辑
	  */
	  public function edit(){
	  	if(IS_POST){
	  		$model=$this->model;
			if(!$model->editTypeattr()) $this->error($this->model->error);
			$this->success('修改成功',U('Type/index'));
	  	}
		//获取taid
		$taid=Q('get.taid',0,'intval');
		//获取旧数据
		$oldData=$this->model->where("taid={$taid}")->find();
		$this->assign('oldData',$oldData);
      	$this->display();
	  }
	  /**
	   * 添加
	   */
	   public function add(){
	   	
	       $this->display();
	   }
 }
 
 
 
 
 
 
 
 
 
 
 




 ?>